import Vue from 'vue'
import App from './App.vue'
//引入路由
import router from '@/router'
//引入全局组件
import TypeNav from '@/components/TypeNav'
import Carousel from '@/components/Carousel'
import Pagination from '@/components/Pagination'
//引入插件
import {Button,MessageBox} from 'element-ui'
import VueLazyload from 'vue-lazyload'
//引入校验插件
import '@/plugins/validate'
//引入仓库
import store from '@/store'
//统一引入所有接口
import * as API from '@/api'


Vue.config.productionTip = false
//注册全局组件
Vue.component(TypeNav.name, TypeNav)
Vue.component(Carousel.name, Carousel)
Vue.component(Pagination.name, Pagination)
//注册全局组件
Vue.component(Button.name, Button)
//挂在原型上来注册
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

Vue.use(VueLazyload)

//执行mock
import '@/mock/mockServe'
//引入swiper
import 'swiper/css/swiper.css'

new Vue({
  render: h => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this;
    Vue.prototype.$API = API
  },
  //注册路由
  router,
  store
}).$mount('#app')
